import { findBanner } from '@/api/home'
import { findTopCategory } from '@/api/category'
import { ref, onMounted } from 'vue'
import { useRoute } from 'vue-router'
export function getListData () {
  const sliders = ref([])
  const route = useRoute()
  onMounted(async () => {
    getList()
    const res = await findBanner()
    sliders.value = res.result
  })
  const subObj = ref({})
  async function getList (id = route.params.id) {
    console.log(route)
    const res = await findTopCategory(id)
    subObj.value = res.result
  }
  return {
    sliders,
    subObj
  }
}
